package com.tanhua.dubbo.api.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.domain.db.SoulOptions;
import com.tanhua.dubbo.api.SoulOptionsApi;
import com.tanhua.dubbo.mapper.SoulOptionsMapper;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class SoulOptionsApiImpl implements SoulOptionsApi {

    @Autowired
    private SoulOptionsMapper soulOptionsMapper;
    /**
     * 根据题号 拿到所有选项列表
     * @param questionId
     * @return
     */
    @Override
    public List<SoulOptions> findSoulOptionsList(String questionId) {
        List<SoulOptions> list = soulOptionsMapper.findOption(questionId);
        return list;
    }
    /**
     *获取总分
     */
    @Override
    public Integer findScore(String questionId, String optionId) {
//        QueryWrapper<SoulOptions> queryWrapper = new QueryWrapper<>();
//        queryWrapper.eq("question_id",questionId).eq("option_id",optionId);
//        SoulOptions soulOptions = soulOptionsMapper.selectOne(queryWrapper);
        Integer score = soulOptionsMapper.findScore(questionId,optionId);
        return score;
    }

}
